package com.enums;

import com.write.DefaultWriteData;
import com.write.TableWriteData;
import com.write.WriteDataHandle;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum WriteDataHandleEnum {
    DEFAULT_HANDLE(new DefaultWriteData()),
    TABLE_HANDLE(new TableWriteData()),
    OTHER(new DefaultWriteData());


    private WriteDataHandle writeDataHandle;

    /**
     * 获取处理类
     * @param dataTypeEnum
     * @return
     */
    public static WriteDataHandle writeDataHandle(DataTypeEnum dataTypeEnum) {
        if (DataTypeEnum.LIST == dataTypeEnum) {
            return TABLE_HANDLE.getWriteDataHandle();
        }else if (DataTypeEnum.STRING == dataTypeEnum) {
            return DEFAULT_HANDLE.getWriteDataHandle();
        }
        return OTHER.getWriteDataHandle();
    }
}
